$(function(){
		var pathName = document.location.pathname;
		var index = pathName.substr(1).indexOf("/");
		var result = pathName.substr(0,index+1);
		getProductList("","","");
		nextView();
		function getProductList(epcChildId,pageIndex,pageSize){
			$.ajax({
				url:result+"/pro/List",
				dataType:"json",
				data:"epcChildId="+epcChildId+"&pageIndex="+pageIndex+"&pageSize="+pageSize,
				Type:"get",
				success:function(data){
					if(data.success){
						gender(data.data);
					}else{
						alert(data.message);
					}
				},
				error:function(){
					alert("请求响应出错");
				}
			})
		}
		function gender(data){
			for(var i=0;i<data.length;i++){
				var str = "<li><dl><dt><a href='product-view.html?epId="+data[i].epId+"' target='_blank'><img src='../../statics/images/product/"+data[i].epFileName+"' /></a></dt><dd class='title'><a href='product-view.html?epId="+data[i].epId+"' target='_blank'>"+data[i].epName+"</a></dd><dd class='price'>￥"+data[i].epPrice+"</dd></dl></li>";
				$(".price-off ul").append(str);
				$(".hot ul").append(str);
			}
		}
		
		function nextView(){
			var epId = sessionStorage.getItem("epId");
			if(epId != null && epId != undefined){
				$.ajax({
					url:result+"/pro/view",
					data:"epId="+epId,
					dataType:"json",
					type:"get",
					success:function(data){
						if(data.success){
							proRender(data.data);
						}else{
							alert(data.message);
						}
					},
					error:function(){
						alert("获取用户详情信息失败");
					}
				});
			}
		}
		
		function proRender(data){
			var str = "<dt><img src='../../statics/images/product/"+data.epFileName+"' /></dt><dd><a href='product-view.html?epId="+data.epId+"'>"+data.epName+"</a></dd>"
			$(".last-view dl").append(str);
		}
		
		
		
	})